#include <opencv2/opencv.hpp>
#include <iostream>


using namespace cv;
using namespace std;

int main(int argc,char **argv) {

	Mat src = imread("F:/opencv/car.jpg");
	if (src.empty()) {
		cout << "coule not load image";
		return -1;
	}
	//namedWindow("car",CV_WINDOW_AUTOSIZE);
	//imshow("car",src);

	/*Mat dst;
	dst = Mat(src.size(), src.type());
	dst = Scalar(127,0,255);
	namedWindow("carOutput", CV_WINDOW_AUTOSIZE);
	imshow("carOutput", dst);*/

	Mat dst = src.clone();
	//src.copyTo(dst);
	//namedWindow("carOutput", CV_WINDOW_AUTOSIZE);

	cvtColor(src, dst, CV_RGB2GRAY);
	cout << "carOutput image channels" << src.channels() << endl;
	cout << "carOutput image channels" << dst.channels() << endl;

	

	const uchar* firstRow = dst.ptr<uchar>(10);
	printf_s("%d\n", *(firstRow+50));
	//imshow("carOutput", dst);

	/*Mat M(3, 3, CV_8UC1, Scalar(255));
	cout << "M = " << endl << M << endl;*/

	
	Mat m1;
	
	m1.create(src.size(), src.type());
	m1 = Scalar(0,0,255);
	namedWindow("carOutput", CV_WINDOW_AUTOSIZE);
	imshow("carOutput", m1);

	waitKey(0);
	return 0;
}